$(document).ready(function(){
    $("#foot_img").children("img.cir").hover(function(){
        $(this).css({"background-color":"#f60","padding":"3px","border":"none"});
        if(($(this).index())==0){
            $("img.squ").css("display","block")
        }
    },
    function(){
        $(this).css({"background":"none","padding":"0","border":" 3px solid #ccc"})
        if(($(this).index())==0){
            $("img.squ").css("display","none")
        }
    })

    $.ajax({
        url:"https://mock.presstime.cn/mock/62a0634ef6ec0f001a6899f1/active/hihi",
        type:"get",
        dataType:"json",
        success:function(res){
            $.each(res,function(index,data){
                $("#sec2").append("<div class=' sec2_wins col-lg-6 col-md-6 col-sm-12 col-xs-12'><div><a href='#'><img src="+data.new_img+"></a><div class ='d-flex justify-content-between'><a class='new_title'>"+data.new_title+"</a><span id='new_status_"+index+"'>"+data.new_status+"</span></div><p class='new_content'>"+data.new_content+"</p><div id='sec2_history'><span id='sec2_history_tit_"+index+"'></span><span id='sec2_history_"+index+"'></span></div></div></div>");
                if(data.new_status==="已结束"){
                    $("#new_status_"+index+"").css({"background":"#ccc","border":"1px solid #888","border-radius":"3px","padding":"0 5px"})
                }
                else{
                    $("#new_status_"+index+"").css({"background":"#f44","color":"#fff","border":"1px solid #ccc","border-radius":"5px","padding":"0 5px"})
                }
                if(data.new_history==="1"){
                    $("#sec2_history_tit_"+index+"").html("往期回顾：")
                    $.each(data.history_link,function(index_his,data_his){
                        $("span#sec2_history_"+index+"").prepend("<a href="+data_his+">"+index_his+"</a>")
                    })
                }
            })
        }
    })
    $.ajax({
        url:"https://mock.presstime.cn/mock/62a0634ef6ec0f001a6899f1/active/sec4",
        type:"get",
        dataType:"json",
        success:function(res){
            $.each(res,function(index,data){
                $("#sec4").append(
                    "<div class='sec4_wins col-lg-4 col-md-6 col-sm-6 col-xs-12'><div><a href='#'><img src="+data.new_img+"></a><div class ='d-flex justify-content-between'><a class='new_title' style='width:60%;'>"+data.new_title+"</a><span id='new4_status_"+index+"' style='background:#ccc;border:1px solid #888;border-radius:3px;padding:0 5px'>"+data.new_status+"</span></div><div class ='d-flex justify-content-between' style='font-size:12px;background:#ddd; '><span>"+data.new_adress+"</span><span>"+data.new_time+"</span></div></div></div>");

            })
        }
    })
    $("#sec2,#sec4").on("mouseenter",".sec2_wins,.sec4_wins",function(){
        $(this).css("box-shadow","0 0 20px #888")
    })
    $("#sec2,#sec4").on("mouseleave",".sec2_wins,.sec4_wins",function(){
        $(this).css("box-shadow","")
    })
    
})